Silicon resistors have been frequently used in integrated circuit (IC) design. The silicon resistors can provide impedance matching for various applications, such as analog, radio frequency (RF) and mixed-mode circuits. Likewise, due to shrinking technology nodes, high dielectric constant (high K) dielectric material and metal are often considered to form a gate stack for a semiconductor device such as a metal-oxide-semiconductor field-effect transistor (MOSFET). However, various integration issues exist when combining silicon resistors and metal-gate MOSFETs onto a single IC chip. One solution is to utilize a dummy gate when forming a silicon resistor. Gate replacement processes, such as an etching process, a metal-gate filling process and a planarizing process, can be implemented to replace the dummy gate. However, the formed silicon resistor may be damaged or metal residues may be formed during the gate replacement processes. Therefore, electrical shorting and device failure could occur.